package high.concurent.feign;

import high.concurent.feign.impl.CouponFeignServiceImpl;
import high.concurrent.dto.NewUserDTO;
import high.concurrent.utils.JsonData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @FeignClient("coupon")要写coupon服务的服务名
 */
@FeignClient(name = "coupon", fallback = CouponFeignServiceImpl.class)
public interface CouponFeignService {

    /**
     * 新用户注册发放优惠券
     * 1. 查询新人注册可以发放的所有优惠券
     * 2. 构造ThreadLocal
     * 3. 循环查询的优惠券，逐个添加
     * @param newUserDTO  用户信息
     * @return
     */
    @PostMapping("/api/coupon/v1/RPCNewCouponRecord")
    JsonData RPCNewCouponRecord(@RequestBody NewUserDTO newUserDTO);
}
